<?php
	//manager인지를 확인하기 위한 php code.
	include("./Action/config.php");
	session_start();
	$user_check = $_SESSION['login_user'];
	if($user_check != "admin"){
		header("./index.php");
		exit();
	}  
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Lock of Han Seok-bong - Manager page</title>
		<script src="./Scripts/jquery-1.10.2.min.js"></script>
	</head>
	<body>
		<h1>YOU ARE MANAGER</h1>
		<table border="1">
			<caption>User Information Table</caption>
			<thead>
				<tr>
				<td>ID</td>
				<td>REGISTERED DATE</td>
				<td>PASSWORD</td>
				</tr>
			</thead>
			<tbody>
			<?php
				$sql = "SELECT * FROM MEMBERS";
				$result = mysql_query($sql);
				$count = mysql_num_rows($result);
				if($count <= 0){
					echo "Nothing to be registered";
				}else{
					while ($row = mysql_fetch_array($result)) {
						echo "<tr><td>" . $row['id'] . "</td><td>"
						. $row['register_date'] . "</td><td>"  
						. $row['password'] . "</td></tr>";
					};
				}
			?>
			</tbody>
		</table>
		<button id="btn_logout">logout</button>
	</body>
	<script>
		$(document).ready(function(){
			$('#btn_logout').click(function(){
				$(location).attr('href','./Action/logout.php');
			});
		});
	</script>
</html>

